#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
from sqlalchemy import Column, BigInteger, String, Date
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()

sys.path.append(r"web")
sys.path.append(r"algorithm")
sys.path.append(r"cta")


class StockInfo(Base):
    """
    股票信息
    """

    __tablename__ = 'stock_info'

    def __init__(self, id, board_id, code, name, url_param, mark, delist, last_transaction_date):
        self.id_ = id
        self.board_id = board_id
        self.code_ = code
        self.name_ = name
        self.url_param = url_param
        self.mark = mark
        self.delist = delist
        self.last_transaction_date = last_transaction_date

    # 主键
    id_ = Column(BigInteger, primary_key=True, autoincrement=True)

    # 表示股票所属的板块的ID
    board_id = Column(BigInteger, primary_key=True, autoincrement=True)

    # 代码
    code_ = Column(String(32))

    # 名称
    name_ = Column(String(32))

    # 从网上调用api，获取数据的接口的参数
    url_param = Column(String(32))

    # R表示融资融券
    mark = Column(String(32))

    # 1表示已经退市，空或其他表示未退市
    delist = Column(BigInteger)

    # 退市股票的最后交易日期
    last_transaction_date = Column(Date)
